{% extends "base.html" %}

{% block content %}
<div class="row justify-content-center">
    <div class="col-md-6">
        <div class="card">
            <div class="card-header">
                <h4 class="card-title mb-0">用户注册</h4>
            </div>
            <div class="card-body">
                <form method="POST" action="{{ url_for('auth.register') }}">
                    {{ form.hidden_tag() }}
                    <div class="mb-3">
                        {{ form.username.label(class="form-label") }}
                        {{ form.username(class="form-control") }}
                        {% if form.username.errors %}
                            {% for error in form.username.errors %}
                                <div class="text-danger">{{ error }}</div>
                            {% endfor %}
                        {% endif %}
                    </div>
                    <div class="mb-3">
                        {{ form.email.label(class="form-label") }}
                        {{ form.email(class="form-control") }}
                        {% if form.email.errors %}
                            {% for error in form.email.errors %}
                                <div class="text-danger">{{ error }}</div>
                            {% endfor %}
                        {% endif %}
                    </div>
                    <div class="mb-3">
                        {{ form.password.label(class="form-label") }}
                        {{ form.password(class="form-control") }}
                        {% if form.password.errors %}
                            {% for error in form.password.errors %}
                                <div class="text-danger">{{ error }}</div>
                            {% endfor %}
                        {% endif %}
                    </div>
                    <div class="mb-3">
                        {{ form.confirm_password.label(class="form-label") }}
                        {{ form.confirm_password(class="form-control") }}
                        {% if form.confirm_password.errors %}
                            {% for error in form.confirm_password.errors %}
                                <div class="text-danger">{{ error }}</div>
                            {% endfor %}
                        {% endif %}
                    </div>
                    <div class="mb-3">
                        {{ form.role.label(class="form-label") }}
                        {{ form.role(class="form-select") }}
                        {% if form.role.errors %}
                            {% for error in form.role.errors %}
                                <div class="text-danger">{{ error }}</div>
                            {% endfor %}
                        {% endif %}
                    </div>
                    <div class="d-grid gap-2">
                        {{ form.submit(class="btn btn-primary") }}
                        <a href="{{ url_for('auth.login') }}" class="btn btn-link">已有账号？立即登录</a>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{% endblock %} 